How can I properly delete the last element after updating an array in Java

visit shbcf.ru